<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Linkslistshuoma extends Model
{
    protected $table = 'links_lists_huoma';
    protected $primaryKey = 'id';

    public static function getLinksListsHuoma($links_id)
    {
        return self::where("links_id", $links_id)->where("state", 1)->orderBy("id","DESC")->first();
    }

    public static function updateLinksListsHuomaState($huoma_id,$state)
    {
        return self::where("huoma_id", $huoma_id)->update(["state"=>$state]);
    }

    public static function insertLinksListsHuoma($links_id,$huoma_id,$work_url,$end_time)
    {
        return self::insert(["links_id"=>$links_id,"huoma_id"=>$huoma_id,"work_url"=>$work_url,"end_time"=>$end_time,"created_at"=>time()]);
    }
}
